//
//  DSSHMeFooterPrintVC.m
//  DSSH
//
//  Created by lcy on 16/4/5.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHMeFooterPrintVC.h"

@interface DSSHMeFooterPrintVC ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView* footerTableView;
@end

@implementation DSSHMeFooterPrintVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupViewAndData];
    // Do any additional setup after loading the view.
}
-(void)setupViewAndData
{
    self.title = @"我的足迹";
    self.view.backgroundColor = [UIColor whiteColor];
    self.footerTableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.footerTableView.delegate = self;
    self.footerTableView.dataSource = self;
    self.footerTableView.tableFooterView = [[UIView alloc]init];
    [self.view addSubview:self.footerTableView];
    
    UIBarButtonItem * backBarBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStylePlain target:self action:@selector(backBarBtnClick)];
    self.navigationItem.leftBarButtonItem = backBarBtn;
}
-(void)backBarBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0)
    {
        return 1;
    }else
    {
        return 5;
    }
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0)
    {
        UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
        if (!cell)
        {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID1"];
        }
        UIImageView * timeImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shijian"]];
        [cell.contentView addSubview:timeImageView];
        
        UIImageView * zujiImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"zuji"]];
        [cell.contentView addSubview:zujiImageView];
        
        [timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(cell.contentView.mas_centerY);
            make.left.equalTo(cell.contentView).with.offset(70*WIDTH_SCALE);
            make.size.mas_equalTo(CGSizeMake(26*WIDTH_SCALE, 26*WIDTH_SCALE));
        }];
        [zujiImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(cell.contentView.mas_centerY);
            make.right.equalTo(cell.contentView).with.offset(-70*WIDTH_SCALE);
            make.size.mas_equalTo(CGSizeMake(26*WIDTH_SCALE, 26*WIDTH_SCALE));
        }];
        return cell;
    }else
    {
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellID2"];
        if (!cell)
        {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID2"];
            UILabel * timeLabel = [UILabel new];
            timeLabel.textAlignment = NSTextAlignmentCenter;
            timeLabel.tag = 10;
            timeLabel.textColor = [UIColor grayColor];
            timeLabel.font = FONT(13);
            [cell.contentView addSubview:timeLabel];
            
            UILabel * footLabel = [UILabel new];
            footLabel.tag = 20;
            footLabel.textAlignment = NSTextAlignmentCenter;
            footLabel.textColor = [UIColor grayColor];
            footLabel.font = FONT(13);
            [cell.contentView addSubview:footLabel];
            [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.mas_equalTo(cell.contentView.mas_centerY);
                make.left.equalTo(cell.contentView).with.offset(30*WIDTH_SCALE);
                make.right.equalTo(cell.contentView.mas_centerX).with.offset(-10*WIDTH_SCALE);
            }];
            [footLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.mas_equalTo(cell.contentView.mas_centerY);
                make.right.equalTo(cell.contentView).with.offset(-30*WIDTH_SCALE);
                make.left.equalTo(cell.contentView.mas_centerX).with.offset(10*WIDTH_SCALE);
            }];

            
            
        }

        UILabel * timeLabel = [cell.contentView viewWithTag:10];
        timeLabel.text = @"20160103-12:30";
        UILabel * footerLabel = [cell.contentView viewWithTag:20];
        footerLabel.text = @"注册登录";
        return cell;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
